package dd.control;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import dd.model.Event;
import dd.view.MainScreen;
import dd.view.SignInScreen;

public class CreateEventButtonController implements ActionListener {
	/**
	 * call when user click create button in the main screen
	 * set this user as a moderator in the local event
	 * go the the sign in screen
	 */

	// attributes
	MainScreen frame;
	Event event;
	//constructor
	public CreateEventButtonController (MainScreen f, Event event) {
		frame = f;
		this.event = event;
	}

	public void actionPerformed(ActionEvent arg0) {
		//set this user as moderator
		this.event.setAsModerator();
		event.setPostion(0);
		// show createForm
		SignInScreen form = new SignInScreen(event);
		form.setVisible(true);
		
		
		// close mainframe window
		frame.dispose();
	}
}
